package com.luych.toolbox.common.feign.view.data.service;

import com.luych.toolbox.common.enums.DataTransporterPlanStatus;
import com.luych.toolbox.common.feign.FeignView;
import com.luych.toolbox.common.feign.view.base.service.UserView;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Map;

@ApiModel("数据同步计划")
public class DataTransporterPlanView extends FeignView {

    @ApiModelProperty("来源数据源")
    private DataSourceView dataSourceFrom;
    @ApiModelProperty("目标数据源")
    private DataSourceView dataSourceTo;
    @ApiModelProperty("描述")
    private String name;
    @ApiModelProperty("数据表对应关系")
    private Map<String, String> tables;
    @ApiModelProperty("CRON表达式")
    private String cron;
    @ApiModelProperty("状态")
    private DataTransporterPlanStatus status;
    @ApiModelProperty("责任人")
    private UserView owner;

    public DataSourceView getDataSourceFrom() {
        return dataSourceFrom;
    }

    public String getDataSourceFromId() {
        return dataSourceFrom == null ? null : dataSourceFrom.getId();
    }

    public void setDataSourceFrom(DataSourceView dataSourceFrom) {
        this.dataSourceFrom = dataSourceFrom;
    }

    public DataSourceView getDataSourceTo() {
        return dataSourceTo;
    }

    public String getDataSourceToId() {
        return dataSourceTo == null ? null : dataSourceTo.getId();
    }

    public void setDataSourceTo(DataSourceView dataSourceTo) {
        this.dataSourceTo = dataSourceTo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<String, String> getTables() {
        return tables;
    }

    public void setTables(Map<String, String> tables) {
        this.tables = tables;
    }

    public String getCron() {
        return cron;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }

    public DataTransporterPlanStatus getStatus() {
        return status;
    }

    public void setStatus(DataTransporterPlanStatus status) {
        this.status = status;
    }

    public String getStatusValue() {
        return status == null ? null : status.getValue();
    }

    public UserView getOwner() {
        return owner;
    }

    public void setOwner(UserView owner) {
        this.owner = owner;
    }

    public String getOwnerId() {
        return owner == null ? null : owner.getId();
    }
}
